<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" charset="UTF-8"
	src="../js/prefixfree.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/base.css"
	media="all" />
<link rel="stylesheet" type="text/css" href="../css/self.css"
	media="all" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="../viewport" content="width=device-width, initial-scale=1">
<link href="../css/bootstrap.css" rel="stylesheet">
<script src="../js/jquery-1.12.4.min.js"></script>
<script src="../js/bootstrap.js"></script>
</head>
<body>
	<h1>类型添加</h1>
	<div class="jumbotron">
		<form class="form-horizontal">
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">类型名称</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" id="tname"
						placeholder="请输入类型名称">
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" id="sub_btn" class="btn btn-default">提&nbsp;&nbsp;&nbsp;&nbsp;交</button>
				</div>
			</div>
		</form>
	</div>

	<script type="text/javascript">
		$("#sub_btn").click(function(){
			var tname = $("#tname").val();
			if(tname=="" || tname==null){
				alert("请勿提交空白内容!");
				return;
			}else{
				console.log(66);
				$.post("../../admin_type",{
					op:'type_add',
					tname:tname
				},function(data){
					if(data>0){
						alert("添加成功!");
						tname = $("#tname").val("");
					}else{
						alert("添加失败!请稍后重试!");
					}
				});
			}
			
		});
	</script>
</body>